import {createSlice} from '@reduxjs/toolkit'
import {ICountState} from '../../types'
const initialState:ICountState={
    count:0
}
export const counterSlice=createSlice({
    name:'counter',//定义命名空间
    initialState,//定义state初始值
    reducers:{
        increment(state){
            state.count++
        },
        decrease(state){
            state.count--
        }
    }
})
export const {increment,decrease}=counterSlice.actions
export default counterSlice.reducer